package com.woniuxy.intellihome.mapper;

import com.woniuxy.intellihome.entity.SpecDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2021-08-11
 */
public interface SpecDetailMapper extends BaseMapper<SpecDetail> {
    /**
     * 根据sku的id获取其所有规格明细
     * @param skuId skuId
     * @return 属于规格的detail的list
     */
    @Select("SELECT sd.* \n" +
            "FROM `m_spec_detail` sd,`m_goods_spec_detail` gsd\n" +
            "WHERE `spec_detail_id`=sd.id AND gsd.sku_id=#{skuId}")
    List<SpecDetail> getDetailBelong2Sku(int skuId);
}
